package com.daoliuhe.scaffold.mapper;

import com.daoliuhe.scaffold.model.Authorities;
import com.daoliuhe.scaffold.model.Role;
import com.daoliuhe.scaffold.model.RoleAuthoritiesRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface RoleAuthoritiesRelationMapper {
    int deleteByPrimaryKey(BigDecimal id);

    int deleteForAuth(@Param("authId") String authId, @Param("roleIds") List<String> roleIds);

    int deleteRelationForRole(@Param("authIds") List<String> authIds, @Param("roleId") String roleId);

    int insert(RoleAuthoritiesRelation record);

    int insertSelective(RoleAuthoritiesRelation record);

    RoleAuthoritiesRelation selectByPrimaryKey(BigDecimal id);

    int updateByPrimaryKeySelective(RoleAuthoritiesRelation record);

    int updateByPrimaryKey(RoleAuthoritiesRelation record);

    List<Role> getRolePageData(RoleAuthoritiesRelation record);

    int getRolePageCount(RoleAuthoritiesRelation record);

    List<RoleAuthoritiesRelation> select(RoleAuthoritiesRelation record);

    List<Authorities> getAuthPageData(RoleAuthoritiesRelation record);

    /**
     * 根据工号查询权限
     *
     * @param loginId
     * @return
     */
    List<Authorities> getAuthByLoginId(@Param("loginId") String loginId);

    /***
     * 根据角色集合查询权限集合
     * @param roles
     * @return
     */
    List<Authorities> getAuthByRoles(@Param("roles") List<String> roles);

    int getAuthPageCount(RoleAuthoritiesRelation record);

}